<?php

namespace App\Models\GameDB\LotteryDraw;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class AddPoolAccountRecord extends Model
{
    public $connection = 'mysql_game';

    protected $table = 'lottery_pet_draw_add_pool_account_record';

    protected $primaryKey = 'id';

    public $timestamps = true;

    //clear_money不需要记录
    public function addRecord($record)
    {
        if (!empty($record['add_money'])) {
            $account_model = app('model_draw_add_pool_account');
            $account_model->where('game_type', $record['game_type'])->increment('money', $record['add_money']);
            $this->insert($record);
        }

        return true;
    }

    public function admin()
    {
        return $this->hasOne(\App\Models\GameDB\Admin::class, 'auth_id', 'admin_id');
    }
}
